package com.cpi.basilos.silo.view;

import com.cpi.basilos.unit.view.UnitView;
import com.cs.common.utils.StringUtils;

public class SiloEntityView extends SiloView {
	private static final long serialVersionUID = 8239288459267786038L;
	private String origin;
	private String wetness;
	private String wagon;
	private UnitView unitView;
	public String getOrigin() {
		return origin;
	}
	public void setOrigin(String origin) {
		this.origin = origin;
	}
	public String getWetness() {
		return wetness;
	}
	public void setWetness(String wetness) {
		this.wetness = wetness;
	}
	public String getWagon() {
		return wagon;
	}
	public void setWagon(String wagon) {
		this.wagon = wagon;
	}
	public UnitView getUnitView() {
		return unitView;
	}
	public void setUnitView(UnitView unitView) {
		this.unitView = unitView;
	}
	public boolean equals(Object obj) {
		boolean retVal = false;
		if( obj != null ){
			if( obj instanceof SiloEntityView ){
				retVal = ((SiloEntityView)obj).getWagon().equals(getWagon());
			}else if( obj instanceof UnitView ){
				if( ((UnitView)obj).getWagon().equals(getWagon()) ){
					retVal = true;
				}else if( ((UnitView)obj).getWagon(StringUtils.SPACE_CHAR).equals(getWagon()) ){
					retVal = true;
				}else if( ((UnitView)obj).getWagon(StringUtils.SLASH_CHAR).equals(getWagon()) ){
					retVal = true;
				}
			}
		}
		return retVal;
	}
	public int hashCode() {
		return getWagon().hashCode();
	}
	public String toString() {
		return getWagon().toString();
	}
}